﻿using System;
using System.Collections.Generic;
using System.ComponentModel;

namespace BIStudio.Framework.Log
{
    /// <summary>
    ///     日志需要支持基础字段和自定义字段，需要支持按任意字段查询
    ///     存储时要考虑性能，例如按日期存放
    /// </summary>
    public class STDLog
    {
        public long ID { get; set; }
        /// <summary>
        ///     内容模块
        /// </summary>
        [Description("内容模块")]
        public string EntityModule { get; set; }
        /// <summary>
        ///     内容类型，对应数据表名
        /// </summary>
        [Description("内容类型")]
        public string EntityType { get; set; }
        /// <summary>
        ///     内容主键，对应数据表主键
        /// </summary>
        [Description("内容主键")]
        public long EntityID { get; set; }
        /// <summary>
        ///     内容标题，对应数据标题，可为空
        /// </summary>
        [Description("内容标题")]
        public string EntityTitle { get; set; }
        /// <summary>
        ///     操作类型，操作类型，CRUD或绑定到权限系统，表示用户点击了指定的按钮
        /// </summary>
        [Description("操作类型")]
        public string OperateType { get; set; }
        /// <summary>
        ///     操作内容，用户输入
        /// </summary>
        [Description("操作内容")]
        public string OperateContent { get; set; }
        /// <summary>
        ///     操作摘要，用户输入，可为空
        /// </summary>
        [Description("操作摘要")]
        public string OperateSummary { get; set; }
        /// <summary>
        ///     操作详情，从Trace或Exception中获取
        /// </summary>
        [Description("操作详情")]
        public string OperateDetail { get; set; }
        /// <summary>
        ///     用户IP，ALHttpIO.UserHostAddress
        /// </summary>
        [Description("用户IP")]
        public string UserIP { get; set; }
        /// <summary>
        ///     用户名称，ALCurrentUser.UserName
        /// </summary>
        [Description("用户用户名称")]
        public string UserName { get; set; }
        /// <summary>
        ///     用户代码，ALCurrentUser.UserID
        /// </summary>
        [Description("用户代码")]
        public long UserID { get; set; }
        /// <summary>
        ///     写入时间，DateTime.Now
        /// </summary>
        [Description("写入时间")]
        public DateTime CreateTime { get; set; }
        /// <summary>
        ///     日志级别,从方法名中获取
        /// </summary>
        [Description("日志级别")]
        public int LogLevel { get; set; }
        /// <summary>
        /// 附加参数
        /// </summary>
        public Dictionary<string, object> Additional { get; set; }
    }
}